<?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="statisticServicesPeriod" pageWidth="595" pageHeight="842" whenNoDataType="AllSectionsNoDetail" columnWidth="535" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" resourceBundle="ru/apertum/qsystem/reports/templates/i3-label-rep" uuid="3187ac07-ccf4-42db-94b5-5078f03540f0">
	<property name="ireport.zoom" value="2.0"/>
	<property name="ireport.x" value="0"/>
	<property name="ireport.y" value="0"/>
	<parameter name="sd" class="java.util.Date"/>
	<parameter name="ed" class="java.util.Date"/>
	<parameter name="ed1" class="java.util.Date"/>
	<queryString>
		<![CDATA[SELECT
   sr.name as service_name,
   count(*) as client_count,
   round(sum(st.client_wait_period)/count(*)) as wait_avg,
   round(sum(st.user_work_period)/count(*)) as work_avg,
   max(st.client_wait_period) as wait_max,
   min(st.client_wait_period) as wait_min,
   max(st.user_work_period) as work_max,
   min(st.user_work_period) as work_min
FROM
   services sr JOIN statistic st ON    st.state_in<>0 AND    sr.id = st.service_id
WHERE
   st.client_stand_time >= $P{sd} and
   st.client_stand_time <= $P{ed1}
GROUP BY
   sr.name]]>
	</queryString>
	<field name="service_name" class="java.lang.String">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="client_count" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="wait_avg" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="work_avg" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="wait_max" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="wait_min" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="work_max" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<field name="work_min" class="java.lang.Integer">
		<fieldDescription><![CDATA[]]></fieldDescription>
	</field>
	<title>
		<band height="67">
			<line>
				<reportElement uuid="9bfd8455-56d0-4e00-96ce-77c03a69f7fe" x="0" y="5" width="555" height="1"/>
			</line>
			<line>
				<reportElement uuid="e900f0ac-b876-4ad0-b315-9e73f6740b2d" positionType="FixRelativeToBottom" x="0" y="61" width="555" height="1"/>
			</line>
			<textField pattern="">
				<reportElement uuid="31d2afad-f67d-405c-81ac-928c2e1b24c8" x="1" y="35" width="551" height="24"/>
				<textElement textAlignment="Center">
					<font fontName="SansSerif" size="18" isBold="true" isUnderline="false" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{from_date}+" " + (new java.text.SimpleDateFormat("dd.MM.yyyy")).format($P{sd}) + " "+$R{to_date}+" " + (new java.text.SimpleDateFormat("dd.MM.yyyy")).format($P{ed})]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="94f6cf55-20d7-4a77-8fab-b468c5ead117" x="1" y="8" width="554" height="27"/>
				<textElement textAlignment="Center">
					<font size="18" isBold="true" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{statistic_period_services}]]></textFieldExpression>
			</textField>
		</band>
	</title>
	<pageHeader>
		<band/>
	</pageHeader>
	<columnHeader>
		<band height="101">
			<textField>
				<reportElement uuid="e26fefbd-f8a6-4333-ab13-9e82d53b5c01" mode="Opaque" x="1" y="0" width="236" height="101" forecolor="#FFFFFF" backcolor="#999999"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="None" markup="none">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
					<paragraph lineSpacing="Single" lineSpacingSize="5.0"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{service}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="0542fb83-b47b-4554-b837-8f3ff061f8b3" mode="Opaque" x="239" y="0" width="45" height="101" forecolor="#FFFFFF" backcolor="#999999"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="Left">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{client_count}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="88dfdd27-58e7-4370-9af4-e42e3e347931" mode="Opaque" x="286" y="0" width="34" height="101" forecolor="#FFFFFF" backcolor="#999999"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="Left">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{wait_avg}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="7ae3e658-0223-47f1-9596-0774f6035bd8" mode="Opaque" x="322" y="0" width="35" height="101" forecolor="#FFFFFF" backcolor="#999999"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="Left">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8_R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{work_avg}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="711d61ff-d551-43b9-9be3-fb2e9e08151a" mode="Opaque" x="359" y="0" width="48" height="101" forecolor="#FFFFFF" backcolor="#999999"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="Left">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8_R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{wait_max}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="2923e554-a4c9-490e-9e7d-61a46370e5f7" mode="Opaque" x="409" y="0" width="48" height="101" forecolor="#FFFFFF" backcolor="#999999"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="Left">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8_R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{wait_min}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="64001074-e823-4a0f-9756-2babb13d0506" mode="Opaque" x="459" y="0" width="46" height="101" forecolor="#FFFFFF" backcolor="#999999"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="Left">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8_R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{work_max}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="fd577a7b-c002-4289-804e-921343158924" mode="Opaque" x="507" y="0" width="48" height="101" forecolor="#FFFFFF" backcolor="#999999"/>
				<textElement textAlignment="Center" verticalAlignment="Middle" rotation="Left">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8_R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{work_min}]]></textFieldExpression>
			</textField>
		</band>
	</columnHeader>
	<detail>
		<band height="21">
			<textField isStretchWithOverflow="true">
				<reportElement uuid="2f341b7d-ec31-4b52-a0a7-93da7f6d191b" mode="Opaque" x="322" y="0" width="37" height="20" backcolor="#F4F4FF"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{work_avg}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="d08d5198-33ef-4bac-bea6-fd26d9b42e1b" mode="Opaque" x="359" y="0" width="50" height="20" backcolor="#CCCCFF"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{wait_max}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="dbdd2808-bf98-4455-b8a9-2b3f739d411e" mode="Opaque" x="409" y="0" width="50" height="20" backcolor="#F4F4FF"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{wait_min}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="e246d525-192b-4a14-8739-f4d5d1e82f54" mode="Opaque" x="459" y="0" width="48" height="20" backcolor="#CCCCFF"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{work_max}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="3fde811a-de95-449b-88ce-fda3538efb1a" mode="Opaque" x="507" y="0" width="48" height="20" backcolor="#F4F4FF"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{work_min}]]></textFieldExpression>
			</textField>
			<textField isStretchWithOverflow="true">
				<reportElement uuid="d5c19d96-d6d0-4219-9e92-b1fd73034303" mode="Opaque" x="286" y="0" width="36" height="20" backcolor="#CCCCFF"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{wait_avg}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="a85272ce-2276-4d64-9406-f85598595a91" mode="Opaque" x="239" y="0" width="47" height="20" backcolor="#F4F4FF"/>
				<textElement textAlignment="Center" verticalAlignment="Middle">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{client_count}]]></textFieldExpression>
			</textField>
			<textField>
				<reportElement uuid="0a75faf1-9183-4b58-a874-8469e5faaf54" stretchType="RelativeToBandHeight" mode="Opaque" x="0" y="0" width="239" height="20" isPrintInFirstWholeBand="true" isPrintWhenDetailOverflows="true" backcolor="#CCCCFF"/>
				<textElement textAlignment="Left" verticalAlignment="Middle">
					<font size="12" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
					<paragraph tabStopWidth="4000"/>
				</textElement>
				<textFieldExpression><![CDATA[$F{service_name}]]></textFieldExpression>
			</textField>
			<line>
				<reportElement uuid="c70b06b9-372a-4aa4-97c2-2a733c5eda95" x="0" y="20" width="555" height="1"/>
			</line>
		</band>
	</detail>
	<pageFooter>
		<band height="21">
			<textField evaluationTime="Report" pattern="" isBlankWhenNull="false">
				<reportElement uuid="b6eaf61b-16ee-4be1-9aca-dd4357634957" key="textField" x="516" y="2" width="36" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font size="10" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA["" + $V{PAGE_NUMBER}]]></textFieldExpression>
			</textField>
			<textField pattern="" isBlankWhenNull="false">
				<reportElement uuid="dc6d50d4-492d-4504-9c08-801cc5cf76d1" key="textField" x="296" y="2" width="216" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement textAlignment="Right">
					<font size="10" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[$R{page}+" " + $V{PAGE_NUMBER} + " "+$R{from}+" "]]></textFieldExpression>
			</textField>
			<textField pattern="" isBlankWhenNull="false">
				<reportElement uuid="11f6f6ed-bc77-4fa6-a013-570335e76f90" key="textField" x="1" y="2" width="209" height="19" forecolor="#000000" backcolor="#FFFFFF"/>
				<box>
					<topPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<leftPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<bottomPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
					<rightPen lineWidth="0.0" lineStyle="Solid" lineColor="#000000"/>
				</box>
				<textElement>
					<font size="10" pdfFontName="tahoma.ttf" pdfEncoding="KOI8-R" isPdfEmbedded="true"/>
				</textElement>
				<textFieldExpression><![CDATA[new Date()]]></textFieldExpression>
			</textField>
		</band>
	</pageFooter>
</jasperReport>
